package com.zhiyou.serviceImpl;



import com.zhiyou.dao.LogDao;

import com.zhiyou.daoImpl.LogDaoImpl;

import com.zhiyou.model.Log;
import com.zhiyou.service.LogService;
import com.zhiyou.util.PageBean;

public class LogServiceImpl implements LogService {

	@Override
	public PageBean<Log> show(int pc,int ps) {
		LogDao ld = new LogDaoImpl();
		PageBean<Log> pageBean = ld.findAll(pc, ps);
		return pageBean;
	}

	@Override
	public Log find(int id) {
		LogDao ld = new LogDaoImpl();
		Log log = ld.findById(id);
		return log;
	}

	@Override
	public boolean delete(int id) {
		LogDao ld = new LogDaoImpl();
		boolean flag = ld.delete(id);
		return flag;
	}

	@Override
	public boolean update(Log log) {
		LogDao ld = new LogDaoImpl();
		boolean flag = ld.update(log);
		return flag;
	}

	@Override
	public boolean add(Object obj[]) {
		LogDao ld = new LogDaoImpl();
		boolean flag = ld.add(obj);
		return flag;
	}

	@Override
	public boolean dels(int[] id) {
		// TODO Auto-generated method stub
		LogDao ld = new LogDaoImpl();
		int id1[] = ld.dels(id);
		for(int i = 0;i<id1.length;i++){
			if(id1[i] == 0){
				return false;
			}
		}
		return true;
	}

	@Override
	public PageBean<Log> find(String name, String sex, String sal, int pc, int ps) {
		LogDao ld = new LogDaoImpl();
		PageBean<Log> pageBean = ld.find(name, sex, sal, pc, ps);
		return pageBean;
		
	}
	
}
